import java.util.Random;
import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 86155
 * date: 2024-01-22
 * Time: 15:44
 *
 * @author 逻辑控制
 */

public class test {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        int sum = 0;
        int num = 0;
        System.out.println("请输入:");
        while(scanner.hasNextInt()){
            System.out.println("请输入:");
            int tmp = scanner.nextInt();
            sum += tmp;
            num++;
        }
        System.out.println("sum = "+sum);
        System.out.println("avg = "+sum/num);
        scanner.close();
    }
    public static void main6(String[] args) {
        /*//系统自动生成一个随机整数(1-100), 然后由用户输入一个猜测的数字. 如果输入的数字比该随机数小, 提示 "低
        //了", 如果输入的数字比该随机数大, 提示 "高了" , 如果输入的数字和随机数相等, 则提示 "猜对了" .
        Scanner scanner = new Scanner(System.in);
        Random random = new Random();
        int game = random.nextInt(100);
        System.out.println(game);
        while(true){
            System.out.println("请输入:");
            int a = scanner.nextInt();
            if(a > game){
                System.out.println("大了");
                continue;
            }else if(a < game){
                System.out.println("小了");
                continue;
            }else
                System.out.println("猜对了"+a);
            break;
        }*/
    }
    public static void main5(String[] args) {
       /* Scanner scanner = new Scanner(System.in);
        System.out.println("请输入你的名字:");
        String name = scanner.nextLine();
        System.out.println("请输入你的年龄:");
        int age = scanner.nextInt();
        System.out.println("请输入你的工资:");
        float salary = scanner.nextFloat();
        System.out.println("姓名:"+name+"\n"+"年龄:"+age+"\n"+"工资:"+salary);

        Scanner scanner = new Scanner(System.in);
        int sum = 0;
        int num = 0;
        while(scanner.hasNextInt()){
            int tmp = scanner.nextInt();
            sum += tmp;
            num++;
        }
        System.out.println("sum = "+sum);
        System.out.println("avg = "+sum/num);
        scanner.close();*/
    }
    public static void main4(String[] args) {
        /*//for循环 fori快捷键
        //打印 1 - 10 的数字
        for (int i = 1; i <= 10 ; i++) {
            System.out.println(i);
        }
        //1-100
        for (int i = 1; i <= 100 ; i++) {
            System.out.println(i);
        }
        //计算5的阶乘

        int sum = 0;
        for (int i = 1; i <= 5 ; i++) {
            int ret = 1;
            for (int j = 1; j <= i ; j++) {
                ret *= j;
            }
            sum+=ret;
        }
        System.out.println(sum);*/

    }
    public static void main3(String[] args) {
        //while循环
        //打印1-10
        /*int i = 1;
        while(i<=10){
            System.out.println(i);
            i++;
        }
        //计算1-100的和
        int a = 1;
        int sum = 0;//总和
        int sum1 = 0;//奇数和
        int sum2 = 0;//偶数和
        while(a<=100){
            sum += a;
            if(a%2 == 0){
                sum2+=a;
            }else{
                sum1+=a;
            }
            a++;
        }
        System.out.println("总数"+sum);
        System.out.println("奇数总数"+sum1);
        System.out.println("偶数总数"+sum2);
        int sum = 0;
        int i = 1;
        while(i<=5){
            int ret = 1;
            int j = 1;
            while(j<=i){
                ret *= j;
                j++;
            }
            sum+=ret;
            i++;
        }
        System.out.println(sum);
        //找到 100 - 200 中第一个 3 的倍数
        int i = 100;
        while(i <= 200) {
            if (i % 3 == 0) {
                System.out.println(i);
                break;
            }
            i++;
        }*/

    }
    public static void main2(String[] args) {
      /*int score = 90;
      if(score>=90){
          System.out.println("吃个大鸡腿");
      }else{
          System.out.println("吃个大嘴巴子");
      }
       int score = 100;
        if(score < 60){
            System.out.println("不及格");
        }else if(score >= 60 && score<70){
            System.out.println("及格");
        }else if(score >=70 && score<80){
            System.out.println("良好");
        }else if(score >= 80 && score < 90){
            System.out.println("优秀");
        }else{
            System.out.println("无敌战神");
        }
        int a = 21;
        if(a%2 == 0){
            System.out.println("偶数");
        }else{
            System.out.println("奇数");
        }
        //判断一个数是正数还是负数又或者是0
        int b = -1;
        if(b > 0){
            System.out.println("正数");
        }else if(b < 0){
            System.out.println("负数");
        }else{
            System.out.println(0);
        }
        //判断是否是闰年
        //1.能被四整除，不能被100整除  2.能被400整除
        for (int i = 1000; i <= 2000; i++) {
            if((i%4 == 0 && i%100 != 0)){
                System.out.println(i);
            }else if(i%400 == 0){
                System.out.println(i);
            }
        }
        //switch语句
        //表达式类型 基本类型 int byte short char 引用：String 枚举
        int day = 8;
        switch (day){
            case 1:
                System.out.println("星期一");
                break;
            case 2:
                System.out.println("星期二");
                break;
            case 3:
                System.out.println("星期三");
                break;
            case 4:
                System.out.println("星期四");
                break;
            case 5:
                System.out.println("星期五");
                break;
            case 6:
                System.out.println("星期六");
                break;
            case 7:
                System.out.println("周末");
                break;
            default:
                System.out.println("输入错误");
                break;
        }*/

    }
    public static void main1(String[] args) {
        System.out.println("aaa");
        System.out.println("bbb");
        System.out.println("cccc");
    }
}
